package edu.odu.cs.sstore.service;

import java.util.List;

import org.springframework.security.access.prepost.PreAuthorize;

import edu.odu.cs.sstore.domain.Course;
import edu.odu.cs.sstore.domain.Document;
import edu.odu.cs.sstore.domain.User;
import edu.odu.cs.sstore.dto.CourseDTO;
import edu.odu.cs.sstore.dto.DocumentDTO;
import edu.odu.cs.sstore.dto.UserDTO;

public interface DocumentService {

	@PreAuthorize(value="isAuthenticated()")
	public DocumentDTO getDocument(Long id);
	
	@PreAuthorize(value="isAuthenticated()")
	public List<DocumentDTO> getSharedDocuments();
	
	@PreAuthorize("hasAuthority('ROLE_FACULTY')")
	public List<DocumentDTO> getMyDocuments();
	
	@PreAuthorize("hasAuthority('ROLE_FACULTY')")
	public DocumentDTO createDocument(DocumentDTO document);
	
	// TODO - ensure the user updating the document is the creator of the document
	@PreAuthorize("hasAuthority('ROLE_FACULTY')")
	public DocumentDTO updateDocument(DocumentDTO document);
	
	//TODO - ensure the user sharing the document is the creator of the document
	@PreAuthorize("hasAuthority('ROLE_FACULTY')")
	public void shareDocument(DocumentDTO document, UserDTO user);
	
	//TODO - ensure the user sharing the document is the creator of the document
	@PreAuthorize("hasAuthority('ROLE_FACULTY')")
	public void shareDocument(DocumentDTO document, CourseDTO course);
	
	// TODO - ensure the user deleting the document is the creator of the document
	@PreAuthorize("hasAuthority('ROLE_FACULTY')")
	public void deleteDocument(Long id);
	
}
